import 'package:boss/models/taste.dart';

import 'package:boss/ui/widget/center_title_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:hi_common/hi_common.dart';
import 'package:provider/provider.dart';
import 'package:router/annotation.dart';

import 'provider/taste_setting_provider.dart';
import 'widget/taste_setting_browser.dart';

@RouterConfig(TasteSettingPage.pageName)
class TasteSettingPage extends StatefulWidget {
  static const pageName = '/tasteSettingPage';

  @Autowired()
  final List<Taste> tastes;

  const TasteSettingPage({this.tastes});

  @override
  _TasteSettingPageState createState() => _TasteSettingPageState('添加菜品口味');
}

class _TasteSettingPageState extends BaseState<TasteSettingPage> {
  _TasteSettingPageState(String pageName) : super(pageName);

  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (context) => TasteSettingProvider(tastes: widget.tastes),
      child: Scaffold(
        appBar: CenterTitleAppBar(title: '口味做法'),
        body: TasteSettingBrowser(),
      ),
    );
  }
}
